import {mapGetters} from 'vuex'
export default {
    computed : {
      ...mapGetters('m_cart',['total'])
    },
    onShow() {
      this.getbadge()
    },
    watch : {
      total(newVal) {
        this.getbadge()
      }
    },
    methods : {
      getbadge() {
        let total = this.total.toString()
        if(total <= 0) return uni.removeTabBarBadge({
            index : 1
        })
        uni.setTabBarBadge({
          index : 1,
          text : total
        })
      }
    }
  }